package com.hdax.dm.mapstructs;

import com.hdax.dm.dtos.scheduler.ChooseSeatScheduleDto;
import com.hdax.dm.entity.scheduler.DmSchedulerSeatPrice;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public abstract class SeatPriceDtoMapper {


    @Mappings({
            @Mapping(target = "areaLevelName",expression = "java(longToString(source.getAreaLevel()))")
    })
    public abstract ChooseSeatScheduleDto.SeatPrice toTarget(DmSchedulerSeatPrice source);
    public abstract List<ChooseSeatScheduleDto.SeatPrice> toTargetList(List<DmSchedulerSeatPrice> sources);

    public String longToString(Long areaLevel){
        if(areaLevel == 1L) return "A";
        if(areaLevel == 2L) return "B";
        if(areaLevel == 3L) return "C";
        return "";
    }

}
